/*
 * VariableStringSerializer.h
 *
 *  Created on: Oct 23, 2012
 *      Author: m
 */

#ifndef VARIABLESTRINGSERIALIZER_H_
#define VARIABLESTRINGSERIALIZER_H_

#include <cassert>
#include <string>
#include <cstring>
#include "VariableSizeRecordSerializer.h"

namespace physical
{

class VariableStringSerializer : public VariableSizeRecordSerializer<std::string>
{
private:
    typedef unsigned char str_size_t;

public:
    VariableStringSerializer();

    ~VariableStringSerializer();

    // Métodos para serializacion y deserializacion estática
    size_t serialize( const std::string &element, byteStream block );
    size_t deserialize( const byteStream block, std::string &element );
    size_t computeSize( const std::string &element );

    // Métodos para serializacion y deserializacion dinámica
    size_t serialize( const _T_ptr &element, byteStream block );
    size_t deserialize( const byteStream block, _T_ptr &elementPtr );
    size_t computeSize( const _T_ptr &element );

};

} /* namespace physical */
#endif /* VARIABLESTRINGSERIALIZER_H_ */
